home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Programming / MPW Interfaces & Libraries 3.1 / PInterfaces / Events.p < prev    next >
Encoding:
Text File  |  1989-10-13  |  2.5 KB  |  136 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Thursday, April 20, 1989 at 3:29 PM
  3.     Events.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.     Copyright Apple Computer, Inc.    1985-1988
  7.     All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT Events;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingEvents}
  21. {$SETC UsingEvents := 1}
  22.  
  23. {$I+}
  24. {$SETC EventsIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingTypes}
  27. {$I $$Shell(PInterfaces)Types.p}
  28. {$ENDC}
  29. {$IFC UNDEFINED UsingQuickdraw}
  30. {$I $$Shell(PInterfaces)Quickdraw.p}
  31. {$ENDC}
  32. {$SETC UsingIncludes := EventsIncludes}
  33.  
  34. CONST
  35. nullEvent = 0;
  36. mouseDown = 1;
  37. mouseUp = 2;
  38. keyDown = 3;
  39. keyUp = 4;
  40. autoKey = 5;
  41. updateEvt = 6;
  42. diskEvt = 7;
  43. activateEvt = 8;
  44. networkEvt = 10;
  45. driverEvt = 11;
  46. app1Evt = 12;
  47. app2Evt = 13;
  48. app3Evt = 14;
  49. app4Evt = 15;
  50. osEvt = app4Evt;
  51. charCodeMask = $000000FF;
  52. keyCodeMask = $0000FF00;
  53. adbAddrMask = $00FF0000;
  54. osEvtMessageMask = $FF000000;
  55.  
  56. { OSEvent Messages }
  57.  
  58. mouseMovedMessage = $FA;
  59. childDiedMessage = $FD;
  60. suspendResumeMessage = $01;
  61.  
  62. { event mask equates }
  63.  
  64. mDownMask = 2;
  65. mUpMask = 4;
  66. keyDownMask = 8;
  67. keyUpMask = 16;
  68. autoKeyMask = 32;
  69. updateMask = 64;
  70. diskMask = 128;
  71. activMask = 256;
  72. networkMask = 1024;
  73. driverMask = 2048;
  74. app1Mask = 4096;
  75. app2Mask = 8192;
  76. app3Mask = 16384;
  77. app4Mask = -32768;
  78. everyEvent = -1;
  79.  
  80. { modifiers }
  81.  
  82. activeFlag = 1;     {bit 0 of modifiers for activate event}
  83. btnState = 128;     {Bit 7 of low byte is mouse button state}
  84. cmdKey = 256;        {Bit 0}
  85. shiftKey = 512;     {Bit 1}
  86. alphaLock = 1024;    {Bit 2 }
  87. optionKey = 2048;    {Bit 3 of high byte}
  88. controlKey = 4096;
  89.  
  90.  
  91. TYPE
  92.  
  93.  
  94. EventRecord = RECORD
  95.     what: INTEGER;
  96.     message: LONGINT;
  97.     when: LONGINT;
  98.     where: Point;
  99.     modifiers: INTEGER;
  100.     END;
  101.  
  102. KeyMap = PACKED ARRAY [0..127] OF BOOLEAN;
  103.  
  104.  
  105.  
  106. FUNCTION GetNextEvent(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  107.     INLINE $A970;
  108. FUNCTION WaitNextEvent(mask: INTEGER;VAR event: EventRecord;sleep: LONGINT;
  109.     mouseRgn: RgnHandle): BOOLEAN;
  110.     INLINE $A860;
  111. FUNCTION EventAvail(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  112.     INLINE $A971;
  113. PROCEDURE GetMouse(VAR mouseLoc: Point);
  114.     INLINE $A972;
  115. FUNCTION Button: BOOLEAN;
  116.     INLINE $A974;
  117. FUNCTION StillDown: BOOLEAN;
  118.     INLINE $A973;
  119. FUNCTION WaitMouseUp: BOOLEAN;
  120.     INLINE $A977;
  121. PROCEDURE GetKeys(VAR theKeys: KeyMap);
  122.     INLINE $A976;
  123. FUNCTION TickCount: LONGINT;
  124.     INLINE $A975;
  125. FUNCTION GetDblTime: LONGINT;
  126.     INLINE $2EB8,$02F0;
  127. FUNCTION GetCaretTime: LONGINT;
  128.     INLINE $2EB8,$02F4;
  129.  
  130. {$ENDC}    { UsingEvents }
  131.  
  132. {$IFC NOT UsingIncludes}
  133.     END.
  134. {$ENDC}
  135.  
  136.